<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>mixin</title>
</head>
<body>
    
</body>
</html>
<script>
    const Tool = {
        max(key){
            return this.data.sort((a,b) => b[key] - a[key])[0];
        }
    };

    class Lesson{
        constructor(lessons){
            this.lessons = lessons;
        }
        get data(){
            return this.lessons;
        }
    }

    Object.assign(Lesson.prototype,Tool);

    const data = [
        {name : "js" , price : 100},
        {name : "mysql" , price : 212},
        {name : "vue.js",price:98}
    ];

    let hd = new Lesson(data);
    console.log(hd.max('price'));


</script>